// TypeScript file
class GirlDistanceBar extends egret.Sprite
{
    private head:egret.Bitmap;
    private heightBar: number = 0;
    constructor()
    {
        super();
        this.initView();
    }

    private initView(): void
    {
        let bar: egret.Bitmap = ResourceUtils.createBitmapByName("distanceBar_png");
        this.addChild(bar);

        this.head = ResourceUtils.createBitmapByName("redGirlHead_png");
        this.addChild(this.head);

        bar.x = this.head.width / 2;
        this.heightBar = bar.height;
        this.head.y = this.heightBar;
    }

    public moveHead(totalNum: number = 0, freeTime: number = 0): void
    {
        this.head.y = this.heightBar - this.heightBar * (GameData.redGirlDistance / (totalNum + freeTime));
    }
}